<?php 
if(!isset($_SESSION)) 
{ 
	session_start(); 
}
if(!isset($_SESSION['browser'])){
	include 'bloghoctap.net_Browser.php';
	$browser= new Browser();
	if($browser->getBrowser() == Browser::BROWSER_FIREFOX)
	     $_SESSION['browser'] = "FIREFOX";
	else if($browser->getBrowser() == Browser::BROWSER_CHROME)
	     $_SESSION['browser'] = "CHROME";
	else if($browser->getBrowser() == Browser::BROWSER_OPERA)
	     $_SESSION['browser'] = "OPERA";
	else if($browser->getBrowser() == Browser::BROWSER_IE)
	     $_SESSION['browser'] = "IE"; 
}
$mngonngu=array("faillogin"=>"User or password is not right","notnull"=>"null data","search"=>"검색","admin"=>"관리자","view"=>"보기","username"=>"ID","password"=>"비밀번호","login"=>"로그인","cancel"=>"취소","tongxetrongthang"=>"금월통과차량","tongxetrongngay"=>"금일통과차량","logout"=>"로그아웃");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
div.img
  {
  margin:2px;
  border:1px solid #0000ff;
  height:auto;
  width:19.4%;
  float:left;
  text-align:center;
  }
div.img img
  {
  display:inline;
  margin:3px;
  border:1px solid #ffffff;
  height:90%;
  width:95%;
  }
div.img a:hover img
  {
  border:1px solid #0000ff;
  }
div.desc
  {
  text-align:center;
  font-weight:normal;
  width:120px;
  margin:2px;
  }
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<title>Elicenter</title>
<link href="css_popup/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css_popup/jquery-ui.css" type="text/css"  />
<script src="js_popup/jquery-1.8.2.js" type="text/javascript"></script>
<script src="js_popup/jquery-ui.js"></script>
<script>
var proactive="";
    $(function() {
    	 var vac="<?php echo $_REQUEST['viewaction'];?>";
    	 if(vac!="none"){
	        $( "#lmain" ).dialog({
	            resizable: false,
	            modal: true
	        });
    	 }else{
    		$( "#lmain" ).hide();
    		loadbutton();
     		loadContentHome1();
     		loadslXe();
    	 }
    });
    function closePopup(){
    	var vac=document.getElementById("vaction").value;
    	 $( "#lmain" ).dialog("close");
    	 if(vac==""){
    		loadbutton();
    		loadContentHome1();
    		loadslXe();
    	 }else if(vac=="view"){
    		 document.getElementById("vaction").value="";
    	 }
    };
    function closePopupcancel(){
    	var vac=document.getElementById("vaction").value;
	   	 $( "#lmain" ).dialog("close");
	   	 if(vac==""){
	   		loadbutton();
	   		loadContentHome1();
	   		loadslXe();
	   	 }else{
	    	 document.getElementById("vaction").value=proactive;
	   	 }
	};
    function onclickLogin(vaction){
        var sc=document.getElementById("vaction").value;
        proactive=sc;
        if(sc=="out"){
        	document.getElementById("vaction").value=vaction;
	        document.getElementById("txtName").value="";
	        document.getElementById("txtPass").value="";
	        document.getElementById("txtName").value="";
	        document.getElementById("viewtb").value="";
	       
	        $( "#lmain" ).dialog({
	            resizable: false,
	            modal: true
	        });
	    	 $( "#lmain" ).dialog("open");
        }else{
        	if(sc!="view"){
        		var vac="<?php echo $_REQUEST['viewaction'];?>";
	           	if(vac!="none"){
	           		document.getElementById("vaction").value=vaction;
	    	        document.getElementById("txtName").value="";
	    	        document.getElementById("txtPass").value="";
	    	        document.getElementById("txtName").value="";
	    	        document.getElementById("viewtb").value="";
	    	        $( "#lmain" ).dialog({
	    	            resizable: false,
	    	            modal: true
	    	        });
	    	    	 $( "#lmain" ).dialog("open");
	           	}else{
	           		var i = document.getElementById('monitorid');
				   	var monitor = i.options[i.selectedIndex].value;
				   	var namemonitor = i.options[i.selectedIndex].label;
				   	if(sc!="out"){
				   		if(vaction=="search"){
		    				window.location="search/searchcarnums.php?monitor="+monitor+"&monitorname="+namemonitor;
		    			}else if(vaction=="admin"){
		    				window.location="admin/content-monitor-admin.php?monitor="+monitor+"&monitorname="+namemonitor;
		    			}else{
		    				window.location="index.php";
		    			}
				   	}else{
				   		$( "#lmain" ).dialog({
		    	            resizable: false,
		    	            modal: true
		    	        });
		    	    	 $( "#lmain" ).dialog("open");
				   	}
	           	}
            }else{
            	var i = document.getElementById('monitorid');
			   	var monitor = i.options[i.selectedIndex].value;
			   	var namemonitor = i.options[i.selectedIndex].label;
    			if(vaction=="search"){
    				window.location="search/searchcarnums.php?monitor="+monitor+"&monitorname="+namemonitor;
    			}else if(vaction=="admin"){
    				window.location="admin/content-monitor-admin.php?monitor="+monitor+"&monitorname="+namemonitor;
    			}else{
    				window.location="index.php";
    			}
    		}
        }
    };

</script>
<?php include 'show_function_popup_carcrime.php';?>
<?php include 'connection/connection.php';
$selectallmonitor = mysql_query('SELECT mn.Name,mn.Monitor_ID FROM monitor mn ORDER BY mn.Pos;',$connection);
?>
<?php mysql_close($connection);?>
<script type="text/javascript">
var SD;
var SD1;
var SDMO;
var SD_MO;
var flagloadContent = 0;
var flag_resize=0;
window.onload = function(){
	load_popup_carCrime();
};
function loadContentHome1(){
	flagloadContent = new Date().getTime();
	flag_resize=0;
	try{
		window.clearTimeout(SD);
	}catch(err){}
	var i = document.getElementById('monitorid');
   	var monitor = i.options[i.selectedIndex].value;
    var winW =window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
    var winH =window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
    $.post("content-home/testmanhinh1.php", { monitorid:monitor, winW:winW, winH:winH}, function(datas){
    	     var inputm = $(datas).find("#inputs");
    	     var tablem = $(datas).find("#tables");
	    	 document.getElementById("count_monitor").innerHTML= $(inputm).html();
	         var numbs=document.getElementById("somanhinh").value;
	         if(numbs!=""){
	             var bd=0;
	             var numb=kt=Number(numbs);
	       	  	 document.getElementById("vitribatdau").value=bd;
	       	   	 document.getElementById("vitriketthuc").value=kt;
	       	 	 document.getElementById("dvcontent").innerHTML = $(tablem).html();
	       	 	 loadContent(numb);
	         }
    });
}
function loadContentHome(numb,bd,kt){
	flag_resize=0;
	flagloadContent = new Date().getTime();
	try{
		window.clearTimeout(SD);
	}catch(err){}
	document.getElementById("vitribatdau").value=bd;
   	document.getElementById("vitriketthuc").value=kt;
	var winW =window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
	var winH =window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 
	var i = document.getElementById('monitorid');
   	var monitor = i.options[i.selectedIndex].value;
	document.getElementById("somanhinh").value=numb;
    $.ajax({url:"content-home/rsmanhinh.php", data:{bd:bd,kt:kt,monitorid:monitor,numb:numb,winW:winW,winH:winH}, success:function(resultloadContentHome){
    	document.getElementById("dvcontent").innerHTML = resultloadContentHome;
		if(numb==1){
			document.getElementById('one').setAttribute("class","choosetest");
			document.getElementById('one').className = "choosetest";
			document.getElementById('four').setAttribute("class","test");
			document.getElementById('four').className = "test";
			document.getElementById('nine').className = "test";
			document.getElementById('nine').setAttribute("class","test");
			document.getElementById('sixteen').className = "test";
			document.getElementById('sixteen').setAttribute("class","test");
			document.getElementById('twentyfive').className = "test";
			document.getElementById('twentyfive').setAttribute("class","test");
			document.getElementById('thirtysix').className = "test";
			document.getElementById('thirtysix').setAttribute("class","test");
			document.getElementById('fourtynine').className = "test";
			document.getElementById('fourtynine').setAttribute("class","test");
			document.getElementById('sixtyfour').className = "test";
			document.getElementById('sixtyfour').setAttribute("class","test");
			}
		else if(numb==4){
			document.getElementById('one').className = "test";
			document.getElementById('one').setAttribute("class","test");
			document.getElementById('four').setAttribute("class","choosetest");
			document.getElementById('four').className = "choosetest";
			document.getElementById('nine').className = "test";
			document.getElementById('nine').setAttribute("class","test");
			document.getElementById('sixteen').className = "test";
			document.getElementById('sixteen').setAttribute("class","test");
			document.getElementById('twentyfive').className = "test";
			document.getElementById('twentyfive').setAttribute("class","test");
			document.getElementById('thirtysix').className = "test";
			document.getElementById('thirtysix').setAttribute("class","test");
			document.getElementById('fourtynine').className = "test";
			document.getElementById('fourtynine').setAttribute("class","test");
			document.getElementById('sixtyfour').className = "test";
			document.getElementById('sixtyfour').setAttribute("class","test");
			}
		else if(numb==9){
			document.getElementById('one').className = "test";
			document.getElementById('one').setAttribute("class","test");
			document.getElementById('four').setAttribute("class","test");
			document.getElementById('four').className = "test";
			document.getElementById('nine').className = "choosetest";
			document.getElementById('nine').setAttribute("class","choosetest");
			document.getElementById('sixteen').className = "test";
			document.getElementById('sixteen').setAttribute("class","test");
			document.getElementById('twentyfive').className = "test";
			document.getElementById('twentyfive').setAttribute("class","test");
			document.getElementById('thirtysix').className = "test";
			document.getElementById('thirtysix').setAttribute("class","test");
			document.getElementById('fourtynine').className = "test";
			document.getElementById('fourtynine').setAttribute("class","test");
			document.getElementById('sixtyfour').className = "test";
			document.getElementById('sixtyfour').setAttribute("class","test");
			}
		else if(numb==16){
			document.getElementById('one').className = "test";
			document.getElementById('one').setAttribute("class","test");
			document.getElementById('four').setAttribute("class","test");
			document.getElementById('four').className = "test";
			document.getElementById('nine').className = "test";
			document.getElementById('nine').setAttribute("class","test");
			document.getElementById('sixteen').className = "choosetest";
			document.getElementById('sixteen').setAttribute("class","choosetest");
			document.getElementById('twentyfive').className = "test";
			document.getElementById('twentyfive').setAttribute("class","test");
			document.getElementById('thirtysix').className = "test";
			document.getElementById('thirtysix').setAttribute("class","test");
			document.getElementById('fourtynine').className = "test";
			document.getElementById('fourtynine').setAttribute("class","test");
			document.getElementById('sixtyfour').className = "test";
			document.getElementById('sixtyfour').setAttribute("class","test");
			}
		else if(numb==25){
			document.getElementById('one').className = "test";
			document.getElementById('one').setAttribute("class","test");
			document.getElementById('four').setAttribute("class","test");
			document.getElementById('four').className = "test";
			document.getElementById('nine').className = "test";
			document.getElementById('nine').setAttribute("class","test");
			document.getElementById('sixteen').className = "test";
			document.getElementById('sixteen').setAttribute("class","test");
			document.getElementById('twentyfive').className = "choosetest";
			document.getElementById('twentyfive').setAttribute("class","choosetest");
			document.getElementById('thirtysix').className = "test";
			document.getElementById('thirtysix').setAttribute("class","test");
			document.getElementById('fourtynine').className = "test";
			document.getElementById('fourtynine').setAttribute("class","test");
			document.getElementById('sixtyfour').className = "test";
			document.getElementById('sixtyfour').setAttribute("class","test");
			}
		else if(numb==36){
			document.getElementById('one').className = "test";
			document.getElementById('one').setAttribute("class","test");
			document.getElementById('four').setAttribute("class","test");
			document.getElementById('four').className = "test";
			document.getElementById('nine').className = "test";
			document.getElementById('nine').setAttribute("class","test");
			document.getElementById('sixteen').className = "test";
			document.getElementById('sixteen').setAttribute("class","test");
			document.getElementById('twentyfive').className = "test";
			document.getElementById('twentyfive').setAttribute("class","test");
			document.getElementById('thirtysix').className = "choosetest";
			document.getElementById('thirtysix').setAttribute("class","choosetest");
			document.getElementById('fourtynine').className = "test";
			document.getElementById('fourtynine').setAttribute("class","test");
			document.getElementById('sixtyfour').className = "test";
			document.getElementById('sixtyfour').setAttribute("class","test");
			}
		else if(numb==49){
			document.getElementById('one').className = "test";
			document.getElementById('one').setAttribute("class","test");
			document.getElementById('four').setAttribute("class","test");
			document.getElementById('four').className = "test";
			document.getElementById('nine').className = "test";
			document.getElementById('nine').setAttribute("class","test");
			document.getElementById('sixteen').className = "test";
			document.getElementById('sixteen').setAttribute("class","test");
			document.getElementById('twentyfive').className = "test";
			document.getElementById('twentyfive').setAttribute("class","test");
			document.getElementById('thirtysix').className = "test";
			document.getElementById('thirtysix').setAttribute("class","test");
			document.getElementById('fourtynine').className = "choosetest";
			document.getElementById('fourtynine').setAttribute("class","choosetest");
			document.getElementById('sixtyfour').className = "test";
			document.getElementById('sixtyfour').setAttribute("class","test");
			}
		else if(numb==64){
			document.getElementById('one').className = "test";
			document.getElementById('one').setAttribute("class","test");
			document.getElementById('four').setAttribute("class","test");
			document.getElementById('four').className = "test";
			document.getElementById('nine').className = "test";
			document.getElementById('nine').setAttribute("class","test");
			document.getElementById('sixteen').className = "test";
			document.getElementById('sixteen').setAttribute("class","test");
			document.getElementById('twentyfive').className = "test";
			document.getElementById('twentyfive').setAttribute("class","test");
			document.getElementById('thirtysix').className = "test";
			document.getElementById('thirtysix').setAttribute("class","test");
			document.getElementById('fourtynine').className = "test";
			document.getElementById('fourtynine').setAttribute("class","test");
			document.getElementById('sixtyfour').className = "choosetest";
			document.getElementById('sixtyfour').setAttribute("class","choosetest");
			}
        loadContent(numb);
    }});
}
function loadslXe(){
	$.ajax({url:"content-home/loadslXe.php", success:function(reulstloadslXe){
		$("#slXe").html(reulstloadslXe);
		SD3=window.setTimeout("loadslXe()",60000);
	}});
}
function loadContent(numb){
	var mySD = new Date().getTime();
	var i = document.getElementById('monitorid');
   	var monitor = i.options[i.selectedIndex].value;
   	var winW =window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
	var winH =window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 
	var bd=Number(document.getElementById("vitribatdau").value);
   	var kt=Number(document.getElementById("vitriketthuc").value);
    var numbs=Number(document.getElementById("somanhinh").value);
     $.ajax({url:"content-home/checkhinh.php", data:{bd:bd,kt:kt,numb:numbs,monitorid:monitor,winW:winW,winH:winH}, success:function(resultloadContent){
    	 if(flagloadContent < mySD){
	    	 document.getElementById("idlist").innerHTML= resultloadContent;
		     var str=document.getElementById("carlist").value;
		     if(str!=""){
		     	document.getElementById("so").value="";
		     	var n=new Array();
		        n=str.split("-");
		     	for (var i = 0; i < n.length; i++)
		     	{
		         	var b=n[i];
		     		load1hinh(b,numbs,bd,kt);
		     		document.getElementById("so").value=document.getElementById("so").value+"-"+n[i];
		     	}
		     }
		     if(flagloadContent < mySD){   
		     	SD = window.setTimeout("loadContent("+numbs+")",1000);
		     }
     	}
     }});
}
function load1hinh(stt,numb,bd,kt){
	var i = document.getElementById('monitorid');
   	var monitor = i.options[i.selectedIndex].value;
   	var winW =window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
	var winH =window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 
	var numbs=Number(document.getElementById("somanhinh").value);
     $.post("content-home/load1hinh.php", {bd:bd,kt:kt,monitorid:monitor,winW:winW,winH:winH,stt:stt,numb:numbs}, function(dataload1hinh){
	    	  document.getElementById("hinh"+stt).innerHTML= dataload1hinh;
	          document.getElementById("sov").value=stt+"-"+document.getElementById("sov").value;
     });
}
function show_prenext_car(numb,idmo,id,bd,kt,vitri){
	flagloadContent = new Date().getTime();
	flag_resize=1;
	try{
		window.clearTimeout(SD);
	}catch(err){}
	var winW =window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
	var winH =window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 
	var numbs=Number(document.getElementById("somanhinh").value);
	$.ajax({url:"content-home/ajax/ajx_showone.php", data : {bd:bd,kt:kt,idcam:id,numb:numbs,idmo:idmo,winW:winW,winH:winH,vitri:vitri}, success:function(resultshow_prenext_car){
		document.getElementById("dvcontent").innerHTML = resultshow_prenext_car;
	}});
}
function view_prenext_car(type,numb,idcam,idmo,vtime,bd,kt){
	flagloadContent = new Date().getTime();
	try{
		window.clearTimeout(SD);
	}catch(err){}
	var winW =window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
	var winH =window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 
	var numbs=Number(document.getElementById("somanhinh").value);
	$.ajax({url:"content-home/ajax/ajx_prenextcar.php", data:{bd:bd,kt:kt,numb:numbs,vtime:vtime,type:type,idcam:idcam,idmo:idmo,winW:winW,winH:winH}, success:function(resultview_prenext_car){
		document.getElementById("dvcontent").innerHTML= resultview_prenext_car;
	}});
}
function testWH(){
	if(flag_resize == 0){
	   	var numb=document.getElementById("somanhinh").value;
	   	var bd=Number(document.getElementById("vitribatdau").value);
	   	var kt=Number(document.getElementById("vitriketthuc").value);
	    if(numb!=""){
	    	var winW =window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
	    	var winH =window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 
	    	var i = document.getElementById('monitorid');
	       	var monitor = i.options[i.selectedIndex].value;
	    	document.getElementById("somanhinh").value=numb;
	        $.ajax({url:"content-home/rsmanhinh.php", data:{bd:bd,kt:kt,monitorid:monitor,numb:numb,winW:winW,winH:winH}, success:function(resulttestWH){
	        	document.getElementById("dvcontent").innerHTML= resulttestWH;
	            loadContent(numb);
	        }});
	    }else{
	    	loadContentHome1();
	    }
	}else if(flag_resize == 1){
		var winW =window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
		var winH =window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 
		var numbs=Number(document.getElementById("somanhinh").value);
		var bd=Number(document.getElementById("vitribatdau").value);
	   	var kt=Number(document.getElementById("vitriketthuc").value);
	   	var id=Number(document.getElementById("vonecaridcam").value);
	   	var idmo=Number(document.getElementById("vonecaridmo").value);
	   	var idone=Number(document.getElementById("vonecarid").value);
		$.ajax({url:"content-home/ajax/ajx_resizeoncecar.php", data : {bd:bd,kt:kt,idcam:id,numb:numbs,idmo:idmo,winW:winW,winH:winH,idone:idone}, success:function(resultshow_prenext_car_resize){
			document.getElementById("dvcontent").innerHTML = resultshow_prenext_car_resize;
		}});
	}
}
function view_logout(){
	var ac=document.getElementById("vaction").value;
	if(ac=="" || ac=="view"){
		$.ajax({url:"view_logout.php?",success:function(resultview_logout){
			$("#view_rs_login").html(resultview_logout);
			document.getElementById("iduserlogin").value="";
			document.getElementById("vaction").value="out";
    	}});
	}else{
		document.getElementById("vaction").value="out";
		window.location="admin/view_logout.php?changepage="+ac;
	}
}
function view_login(){
	var us=document.getElementById("txtName").value;
	var ps=document.getElementById("txtPass").value;
	var ac=document.getElementById("vaction").value;
	if(ac==""){
		ac="view";
	}
	if(us=="" || ps==""){
		document.getElementById("viewtb").value="<?php echo $mngonngu['notnull'];?>";
		if(us==""){
			document.getElementById("txtName").focus();
			document.getElementById("txtName").select();
		}else if(ps==""){
			document.getElementById("txtPass").focus();
			document.getElementById("txtPass").select();
		}
	}else{
		us = encodeURI(us);
		ps = encodeURI(ps)
		$.ajax({url:"aj_login.php", data:{ac:ac,us:us,ps:ps}, success:function(resultlogin){
			document.getElementById("viewrs_tb").innerHTML= resultlogin;
	    	var loi=document.getElementById("idloi").value;
	    	if(loi!=""){
				if(loi=="l_notlogin"){
					document.getElementById("viewtb").value="<?php echo $mngonngu['faillogin']; ?>";
					document.getElementById("txtName").focus();
				}else if(loi=="l_loginok"){
					if(ac=="admin" || ac=="view" || ac=="" || ac=="out" || ac=="viewinsert"){
						if(ac=="viewinsert"){
							$.ajax({url:"aj_menulogin.php?",success:function(resultmenulogin){
								$("#view_rs_login").html(resultmenulogin);
								closePopup();
								document.getElementById("vaction").value="view";
								var iduserlogin=document.getElementById("iduserlogin").value;
								inserAfterLogin(iduserlogin);
					    	}});
						}else{
							var role = document.getElementById("idviewrole").value;
							var i = document.getElementById('monitorid');
						   	var monitor = i.options[i.selectedIndex].value;
							var namemonitor = i.options[i.selectedIndex].label;
							if (role=='Admin'){
								window.location="admin/content-monitor-admin.php?monitor="+monitor+"&monitorname="+namemonitor;
							}else{
								window.location="search/searchcarnums.php?monitor="+monitor+"&monitorname="+namemonitor;
							}
						}
					}else if(ac=="search"){
						var i = document.getElementById('monitorid');
					   	var monitor = i.options[i.selectedIndex].value;
					   	var namemonitor = i.options[i.selectedIndex].label;
						window.location="search/searchcarnums.php?monitor="+monitor+"&monitorname="+namemonitor;
					}else{
						$.ajax({url:"aj_menulogin.php?",success:function(resultmenulogin){
							$("#view_rs_login").html(resultmenulogin);
							closePopup();
							document.getElementById("vaction").value="view";
				    	}});
					}
				}
	    	}
		}});
	}
}
function enterTable(e,value,co){
    var key = window.event ? e.keyCode : e.which;
    if (key == 13 || key == 8 || key == 46  || key == 37 || key == 39 || co == '0') {
		if(key==13){
			var i = 0;
			var j = 0;
			var listID = new Array();
		    listID = listID.concat(["txtName","txtPass"]);	
			for (j = 0; j < listID.length; j++){	
				if (listID[j] == value) {	
					if (j == listID.length - 1) {
						view_login();
					}
					document.getElementById(listID[j + 1]).focus();
					document.getElementById(listID[j + 1]).select();
					return false; 
				}
			}
			return false;
		}else
			return true;	
    } else if ( key < 48 || key > 57 ) {
        return false;
    }
    else return true;
}
function clickprenextlist(type){
	var numb=Number(document.getElementById("somanhinh").value);
	var bd=Number(document.getElementById("vitribatdau").value);
   	var kt=Number(document.getElementById("vitriketthuc").value);
   	if(type=='pre'){
		if(bd>0){
			kt=bd;
			bd=kt - numb;
			if(bd<0){
				bd=0;
			}
			document.getElementById("vitribatdau").value=bd;
			document.getElementById("vitriketthuc").value=kt;
			loadContentHome(numb,bd,kt);
		}
   	}else if(type=='next'){
		if(kt<64){
			bd=kt;
			kt=bd + numb;
			if(kt>64){
				kt=64;
			}
			document.getElementById("vitribatdau").value=bd;
			document.getElementById("vitriketthuc").value=kt;
			loadContentHome(numb,bd,kt);
		}
   	}
}
function loadbutton(){
	$.ajax({url:"content-home/loadbutton.php",success:function(rsbutton){
		$("#idfooterbutton").html(rsbutton);
	}});
}
</script>
</head>
<body  onresize="testWH();" style="overflow: hidden !important;" >
<div id="count_monitor" style="display:none"><input type="hidden" id="somanhinh" name="somanhinh" value="" /></div>
<div id="idlist" style="display:none" ><input type="hidden" id="carlist" name="carlist" value="" /></div>
<div id="maylya" style="display:none" ><input type="hidden"  id="mayly" name="mayly" /></div>
<div style="display: none;">
	<input type="hidden"  id="so" name="so" />
	<input type="hidden"  id="sov" name="sov" />
	<input type="hidden" id="vaction" name="vaction"  />
	<input type="hidden" id="vitribatdau" name="vitribatdau" />
	<input type="hidden" id="vitriketthuc" name="vitriketthuc" />
</div>
	<div style="width:100%; height:100%;">
	 <div title="USER LOGIN" id="lmain" style="background: #CFD6D9;">
		 <form action="process-login.php" method="get" name="f">
	        <div class="login">
	            <p><span class="luser"><?=$mngonngu['username']?></span><input onkeypress="return enterTable(event,this.id,'0');" type="text" class="inright" name="txtName" id="txtName"/></p>
	            <p><span class="luser"><?=$mngonngu['password']?></span><input onkeypress="return enterTable(event,this.id,'0');" type="password" class="inright" name="txtPass" id="txtPass"/></p>
	        </div>
	        <div style="display: inline-block;width: 100%;">
		        <div class="lbtn"><input type="button" onclick="view_login()" value="<?=$mngonngu['login']?>" class="inbtn" name="btnLogin" id="btnLogin"/></div>
		         <div class="lbtncancel"><input type="button" value="<?=$mngonngu['cancel']?>" class="inbtn" onclick="closePopupcancel()"/></div>
		         <div style="margin-right:10px; ;margin-top: 10px; text-align: center;"><input type="text" id="viewtb" name="viewtb" style="color:red;width:100%;background-color:transparent;border:none;" value=""/></div>
	        </div>
	     </form>
     </div>
     <div id="viewrs_tb" style="display:none;"><input type="hidden" id="idloi" /><input type="hidden" value="<?php echo $_SESSION['iduser'];?>" id="iduserlogin" /></div>
    <div id="menu">
    	<ul class="amenu">
    		<li><a href="#" onclick="onclickLogin('search');"><input class="csssearch" type="button"/> </a></li>
        	<li><a href="#" onclick="onclickLogin('admin');"><input class="cssadmin" type="button"/> </a></li>
            <li style="width:215px;background:#1e7bbd"><a href="#"><input class="cssviewchoose" type="button"/></a>
	            <select  class="seltop" size="1" name="monitorid" id="monitorid" onchange="loadContentHome1();">
					<?php 
					if(isset($_SESSION['monitor_menu'])){
						$idmonitor=$_SESSION['monitor_menu'];
					}else{
						$idmonitor=0;
					}
					while ($rowmonitor = mysql_fetch_array($selectallmonitor)){
						if($idmonitor==$rowmonitor[Monitor_ID]){
							?>
				<option value="<?=$rowmonitor[Monitor_ID]?>" id="<?=$rowmonitor[Monitor_ID]?>" selected="selected" label="<?=$rowmonitor[Name]?>"><?php echo $rowmonitor[Name]?></option>
					<?php 
						}else{
						?>
				<option value="<?=$rowmonitor[Monitor_ID]?>" id="<?=$rowmonitor[Monitor_ID]?>" label="<?=$rowmonitor[Name]?>"><?php echo $rowmonitor[Name]?></option>
					<?php 
						}
						}?>
				</select>
            </li>
            <li id="view_rs_login">
            	<?php if(!$_SESSION['usname']){?><a style="cursor: pointer" onclick="onclickLogin('view');"><input class="csslogin" type="button"/> </a><?php }else {
        			if (isset($_SESSION['role'])){
        				?>
        				<a onclick="view_logout()" style="cursor: pointer" ><input class="csslogout" type="button" /></a>
        				<?php 
        			}?>
        		<?php }?>
            </li>
        </ul>
        <div class="clear"></div>
        <div id="iplayer"></div>
    </div>   
    <div style="width:100%;" id="allcontent">
	    <div id="dvcontent" >
		</div>	 
	    <div style="position: fixed;bottom: 10px;left: 0;width: 100%;z-index: 999;">
			<div style="height: 20px;">
				<div id="footer" style="margin: 0 auto;position: relative;">
					<div class="vptrang" style="height: 20px;position: fixed;" id="idfooterbutton" ></div>
		     		<p style="float:right;margin-right: 20px"><input style="background-color:transparent;width:auto;border: none;color:white;" type="text" readonly="readonly"  name="Clock" id="clock" /> </p>  
		    	</div>
	    	</div>
	    </div>
	</div>
	</div>
	 <?php include 'show_content_popup_carcrime.php';?>
</body>
</html>
<script> 
var co=1;
var SD2;
function update() 
{ 
var today=new Date(); 
var hours=today.getHours(); 
var minutes=today.getMinutes(); 
var seconds=today.getSeconds(); 
if (hours<10) 
hours="0"+hours; 
if (minutes<10) 
minutes="0"+minutes; 
if (seconds<10) 
seconds="0"+seconds; 
document.getElementById("clock").value="<?php echo date('Y-m-d');?> "+ hours+":"+minutes+":"+seconds; 
SD2=window.setTimeout("update()",1000); 
} 
update(); 
</script> 
